import React, { Component } from 'react';
import { Radio } from 'antd';

const RadioGroup = Radio.Group;

class ReimbursementSubmissionRadio extends Component {
  constructor(props) {
    super(props);
  }

  handleOnChange = (e) => {
    this.props.onChange(e.target.value,);
  };

  render() {
    const { options, value } = this.props;
    return (
      <section>
        <RadioGroup value={value} onChange={this.handleOnChange}>
          {options.map(optionItem => (
            <Radio key={optionItem.value} value={optionItem.value}>{optionItem.title}</Radio>
          ))}
        </RadioGroup>
      </section>
    );
  }
}

ReimbursementSubmissionRadio.propTypes = {
  options: React.PropTypes.array,
  value: React.PropTypes.string,
  onChange: React.PropTypes.func
};
export default ReimbursementSubmissionRadio;
